import React, { useCallback, useImperativeHandle, useRef, useState } from 'react';
import { LoadPanel, Popup } from 'devextreme-react';
import { LayoutB } from '~/public/cpas-ui';
import { Button, Space, Steps } from 'antd';

import { devPopupTitleRendered, getAccountInfoList, getNanoid10 } from './service';
import { useModel } from 'umi';

import SamplingProjectOverall from './samplingProjectOverall';
import { getIsAdd, getIsEditOrView, getSampleTableList, steps, updateSampleStepDisplay } from './samplingRecordPopupService';
import { msgError, msgInfo } from '@/utils/msg';
import { AccountInfo, SampleStepInfo, ProjectOverallProps, SampleStep, SampleTable, WhereSqlParams, SampleItem, OverallMode, SampleParameterValues, TypedSampleInfo, SampleRecordEditType, SampleRecordEditInfo, TypedSampleTextFieldValues, SampleType, SampleReord } from '../typing';
import SampleParmeter from './SampleParameter';
import { SamplingSampleList } from './samplingSampleList';
import { createAllSampleListTable, getAllSampleDataList, getIniTypedSampleInfo, getTypedSampleList, getTypeSampleDataList, insertAllSampleListTable, updateTableIsChecked } from './samplingSampleListService';
import { getSampleRecordList } from '../tableSamplingRecordService';


// 创建一个 Context 对象
const SampleStepInfoContext = React.createContext<SampleStepInfo>({});

const SamplingRecordPopup = React.forwardRef((props: any, ref: any) => {

    const { initialState } = useModel('@@initialState');
    const { dbname, sjnd } = initialState?.curPart as any;
    const [visible, setVisible] = useState<boolean>(false);
    const popupRef = useRef<any>(null);
    const sampleParmeterRef = useRef<any>(null);
    const samplingSampleListRef = useRef<any>(null);

    //抽样总体引用
    const samplingProjectOverallRef = useRef<any>(null);

    const [loading, setLoading] = useState<boolean>(false);

    const diaParamsRef = useRef<SampleRecordEditInfo>();
    const [stepCurrent, setStepCurrent] = useState(0);


    //样本源的表
    const [sampleTableList, setSampleTableList] = useState<SampleTable[]>([]);
    const [curSampleTable, setCurSampleTable] = useState<SampleTable>();

    const [accountInfoList, setAccountInfoList] = useState<AccountInfo[]>([]);
    // const [typedSampleInfo, setTypedSampleInfo] = useState<TypedSampleInfo>(getIniTypedSampleInfo());
    const [curDataId, setCurDataId] = useState<string>(sjnd);//2024-11-28以前是''
    //sql条件参数
    const [curWhereSqlParams, setCurWhereSqlParams] = useState<WhereSqlParams>();
    //抽样项目
    const [curSampleItem, setCurSampleItem] = useState<SampleItem>({ itemName: '', assertion: [] });

    /**
    * 设置总体的各个set方法和值
    * @param projectOverallProps 
    * @param isUpdateValue 是否更新值
    */
    function setProjectOverallPropsMethodsAndValues(projectOverallProps?: ProjectOverallProps, isUpdateValue?: boolean) {
        if (projectOverallProps) {
            projectOverallProps.setSampleTableList = setSampleTableList;//1
            projectOverallProps.setCurDataId = setCurDataId;//2
            projectOverallProps.setCurWhereSqlParams = setCurWhereSqlParams;//33
            projectOverallProps.setCurSampleItem = setCurSampleItem;//4
            projectOverallProps.setCurSampleTable = setCurSampleTable;//5
            //是否更新值
            if (isUpdateValue) {
                setSampleTableList(projectOverallProps.sampleTableList)//1
                setCurDataId(projectOverallProps.curDataId)//2
                setCurWhereSqlParams(projectOverallProps.curWhereSqlParams);//3
                setCurSampleItem(projectOverallProps.curSampleItem);//4
                setCurSampleTable(projectOverallProps.curSampleTable);//5 放到最后一个,rightContainer 有判断这个变量
            }
        }
    }
    /**
     * 获取初始化的总体
     * @returns 
     */
    function getIniProjectOverallProps(): ProjectOverallProps {

        let projectOverallProps: any = {
            isAutoQueryData: true,//自动打开
            sampleTableList,

            curSampleTable,

            accountInfoList,
            curDataId,

            curWhereSqlParams,

            curSampleTableTotalCount: 0,
            curSampleTableAmountSum: 0,

            curSampleItem,

            overallMode: OverallMode.overallAdd,//总体界面的模式,确定样本总体/浏览/选择

            fixedWhereSql: '',//固定的sql条件如: and jfje=1
        }
        setProjectOverallPropsMethodsAndValues(projectOverallProps, false);
        return projectOverallProps;
    }
    /**
     * 抽样步骤的信息 
     */
    const [sampleStepInfo, setSampleStepInfo] = useState<SampleStepInfo>({
        step0CanRender: true,
        guid: getNanoid10(),
        projectOverallProps: getIniProjectOverallProps(),
    });
    /**
     * 获取样本分类
     * @param sampleParameterValues 
     */
    /*  async function updateTypedSampleInfo(sampleParameterValues?: SampleParameterValues): Promise<TypedSampleInfo> {
 
         //获取样本分类
         if (sampleParameterValues) {
             const typedSampleInfo2 = await getTypedSampleList(sampleStepInfo, sampleParameterValues, false);
             setTypedSampleInfo(typedSampleInfo2)
 
             return typedSampleInfo2;
         }
         return getIniTypedSampleInfo();
     } */
    const changeCurrentNum = async (isAdd: boolean) => {

        const curStepNum = isAdd ? stepCurrent + 1 : stepCurrent - 1;
        if (isAdd) { //获取样本分类
            if (curStepNum == 2) {
                //  await updateTypedSampleInfo(sampleStepInfo.sampleParameterValues);
            }
        }
        setStepCurrent(curStepNum);
    };

    const onChange = (value: number) => {
        setStepCurrent(value);
        if (getIsEditOrView(diaParamsRef.current?.sampleRecordEditType)) {
            //如果是编辑或浏览状态,点击步骤时,各步骤都可以渲染,

            (sampleStepInfo as any)[`step${value}CanRender`] = true;
            //加了这个  SamplingSampleList 会渲染两次,查询2次
            /*    if (value === 2) {
   
                   updateTypedSampleInfo(sampleStepInfo.sampleParameterValues);
               } */
        }
        updateProjectOverallPropsByRef();//点击时也更新参数
    };
    const onCancel = () => {

        diaParamsRef.current?.closeSamplingRecordPopup(false);//关闭弹窗
        setVisible(false);
    }

    // 自定义方法
    useImperativeHandle(ref, () => ({
        show: (params: any) => {
            /* const { sampleRecordEditType, sampleStepInfo, saveSampleRecord,
                closeSamplingRecordPopup, saveSampleRecordAndRefresh } = params; */

            diaParamsRef.current = params;

            let existsDataId = curDataId;
            if (params.sampleRecordEditType == SampleRecordEditType.add && params.existsDataId) {
                existsDataId = params.existsDataId;
                setCurDataId(params.existsDataId);
            }
            setVisible(true);
            setTimeout(() => {

                getSampleTableList(dbname, existsDataId, setSampleTableList).then(async sampleTableList => {
                    if (sampleTableList.length) {

                        const accountInfoListTmp = await getAccountInfoList({ dbname });
                        //如果是编辑或查看,给赋值
                        if (getIsEditOrView(params.sampleRecordEditType)) {
                            const sampleStepInfoOfParams: SampleStepInfo | undefined = diaParamsRef.current?.sampleStepInfo;
                            //const projectOverallPropsOfParams: ProjectOverallProps | undefined = sampleStepInfoOfParams?.projectOverallProps;

                            //获取样本分类
                            sampleStepInfo.guid = sampleStepInfoOfParams?.guid;
                            sampleStepInfo.step1CanRender = true;
                            sampleStepInfo.sampleParameterValues = sampleStepInfoOfParams?.sampleParameterValues;
                            sampleStepInfo.sampleMethodActiveKey = sampleStepInfoOfParams?.sampleMethodActiveKey;
                            sampleStepInfo.projectOverallProps = sampleStepInfoOfParams?.projectOverallProps;
                            if (sampleStepInfo.projectOverallProps) {
                                sampleStepInfo.projectOverallProps.accountInfoList = accountInfoListTmp;
                                sampleStepInfo.projectOverallProps.sampleTableList = sampleTableList;

                                //如果找到原来的表,使用从数据库中查询的,以免 抽样字段有变化
                                let newSampleTable = sampleTableList.find(item => item.tableName == sampleStepInfo.projectOverallProps?.curSampleTable?.tableName)
                                if (newSampleTable) {
                                    sampleStepInfo.projectOverallProps.curSampleTable = newSampleTable;
                                }
                            }

                            //赋予方法和值

                            setProjectOverallPropsMethodsAndValues(sampleStepInfo.projectOverallProps, true)

                            //  setSampleStepInfo({ ...sampleStepInfo }) //不用了,在nextStepClick调用 

                            //如果是编辑或查看,则需要等待数据加载完毕
                            let startTime = Date.now();
                            const interval = setInterval(() => {
                                if (Date.now() - startTime >= 60 * 1000) {
                                    clearInterval(interval);
                                }
                                if (samplingProjectOverallRef.current?.getSampleTotalCount() > 0) {
                                    nextStepClick();//编辑时,显示 步骤2, 这里也会调用setSampleStepInfo  
                                    clearInterval(interval)
                                }
                            }, 10);
                        } else {//新增
                            if (sampleStepInfo.projectOverallProps) {
                                sampleStepInfo.projectOverallProps.sampleTableList = sampleTableList;
                                sampleStepInfo.projectOverallProps.curSampleTable = sampleTableList[0];
                                if (accountInfoListTmp.length) {
                                    let dataId = accountInfoListTmp[accountInfoListTmp.length - 1].Data_ID;

                                    //优先有数据的年度
                                    if (accountInfoListTmp.some(item => item.Data_ID === existsDataId)) {
                                        dataId = existsDataId;
                                    } else if (accountInfoListTmp.some(item => item.Data_ID === sjnd)) {
                                        dataId = sjnd;
                                    }
                                    sampleStepInfo.projectOverallProps.curDataId = dataId;
                                    sampleStepInfo.projectOverallProps.accountInfoList = accountInfoListTmp;
                                }

                                setProjectOverallPropsMethodsAndValues(sampleStepInfo.projectOverallProps, true)

                                setSampleStepInfo({ ...sampleStepInfo })
                            }
                        }
                        // setVisible(true);
                        //初始化值
                    } else {
                        msgError('没有样本源(可能还未转换财务数据),请进行样本源维护!')
                        onCancel();
                        return;
                    }

                })
            }, 300);
        },
    }));


    const leftContainer = useCallback(() => {
        const items = steps.map(item => ({ title: item.title, icon: item.icon, key: item.key }));
        return (
            <div style={{ marginRight: "15px", height: "100%" }} >
                <Steps
                    direction="vertical"
                    size="small"
                    current={stepCurrent}
                    items={items}
                    onChange={onChange}
                />
            </div>
        );
    }, [stepCurrent])


    /**
     * 抽样项目总体属性
     * @returns 
     */
    /*  function getProjectOverallProps(): ProjectOverallProps {
 
         let projectOverallProps: ProjectOverallProps = {
             isAutoQueryData: true,//自动打开
             sampleTableList,
             setSampleTableList,
 
             curSampleTable,
             setCurSampleTable,
 
             accountInfoList,
             curDataId,
             setCurDataId,
 
             curWhereSqlParams,
             setCurWhereSqlParams,
 
             curSampleTableTotalCount: samplingProjectOverallRef.current?.sampleSizeAndAmount.sampleSize || 0,
             curSampleTableAmountSum: samplingProjectOverallRef.current?.sampleSizeAndAmount.amountSum || 0,
 
             curSampleItem,
             setCurSampleItem,
 
             overallMode: OverallMode.overallAdd,//总体界面的模式,确定样本总体/浏览/选择
 
             fixedWhereSql: '',//固定的sql条件如: and jfje=1
         }
         //如果是编辑或浏览状态
         if (diaParamsRef.current?.sampleRecordEditType &&
             [SampleRecordEditType.view, SampleRecordEditType.edit].includes(diaParamsRef.current?.sampleRecordEditType)) {
 
             projectOverallProps.overallMode = OverallMode.overallEdit
 
             const projectOverallPropsOfParams: ProjectOverallProps | undefined = diaParamsRef.current?.sampleStepInfo?.projectOverallProps;
             //如果有传入的的参数,相关的值又没有的时候,用参数值给赋值(用projectOverallPropsOfParams的值给projectOverallProps赋值)
             if (projectOverallPropsOfParams) {
                 if (!projectOverallProps.curWhereSqlParams && projectOverallPropsOfParams?.curWhereSqlParams) {
                     projectOverallProps.curWhereSqlParams = projectOverallPropsOfParams.curWhereSqlParams;
                     setCurWhereSqlParams(projectOverallPropsOfParams.curWhereSqlParams)
                 }
 
                 //初始化状态的curSampleItem
                 if ((projectOverallProps.curSampleItem?.itemName == '' && projectOverallProps.curSampleItem.assertion.length == 0)
                     && projectOverallPropsOfParams?.curSampleItem) {
                     projectOverallProps.curSampleItem = projectOverallPropsOfParams.curSampleItem
                     setCurSampleItem(projectOverallPropsOfParams.curSampleItem);
                 }
             }
         }
 
         return projectOverallProps;
     } */


    //上一步点击
    const previousStepClick = async () => {
        await changeCurrentNum(false)
    }
    /**
     * 增加时,要更新这些值
     */
    async function updateProjectOverallPropsByRef() {
        if (samplingProjectOverallRef.current?.sampleProjectOverallProps) {
            const isAdd = getIsAdd(diaParamsRef.current?.sampleRecordEditType)

            if (isAdd) {
                sampleStepInfo.projectOverallProps = {
                    ...samplingProjectOverallRef.current.sampleProjectOverallProps,
                    curDataId,
                    curWhereSqlParams,
                    curSampleItem,
                    curSampleTable,
                    curSampleTableTotalCount: samplingProjectOverallRef.current?.sampleSizeAndAmount.sampleSize || 0,
                    curSampleTableAmountSum: samplingProjectOverallRef.current?.sampleSizeAndAmount.amountSum || 0,
                }
                setSampleStepInfo({ ...sampleStepInfo })
            } else {//edit or view
                const projectOverallProps: any = sampleStepInfo.projectOverallProps;

                sampleStepInfo.projectOverallProps = {
                    ...projectOverallProps,
                    curSampleTableTotalCount: samplingProjectOverallRef.current?.sampleSizeAndAmount?.sampleSize
                        || projectOverallProps.curSampleTableTotalCount || 0,

                    curSampleTableAmountSum: samplingProjectOverallRef.current?.sampleSizeAndAmount?.amountSum
                        || projectOverallProps.curSampleTableAmountSum || 0,
                }
                //计算重大金额和极不重要金额

            }
            if (stepCurrent == 0 && sampleParmeterRef.current?.calcAmountSampleSizeAndUpdate) {
                await sampleParmeterRef.current?.calcAmountSampleSizeAndUpdate()
            }
        }
    }
    //下一步点击
    const nextStepClick = async () => {

        if (stepCurrent == 0) {
            const projectOverallProps: ProjectOverallProps = samplingProjectOverallRef.current.sampleProjectOverallProps;

            if (projectOverallProps.curSampleTable?.isVoucher) {
                let kmmcStr;
                let msg;
                if (projectOverallProps.curWhereSqlParams?.isAdvQuery) {
                    kmmcStr = projectOverallProps.curWhereSqlParams?.advQueryParams?.
                        filter(item => item.keyString == 'KMMC')
                        .map(item => item.rowConditionsData).join(',');
                    msg = '样本源是凭证表,科目名称不能为空,请在高级查询中设定科目名称';
                } else {
                    kmmcStr = projectOverallProps.curWhereSqlParams?.formQueryParams?.kmmcStr;
                    msg = '样本源是凭证表,科目名称不能为空,请在界面中选择科目名称!';
                }
                if (!kmmcStr) {
                    return msgError(msg);
                }
            }

            if (!projectOverallProps.curSampleItem.itemName) {
                samplingProjectOverallRef.current?.itemNameRef?.current?.instance?.focus()
                return msgError('抽样项目不能为空,请输入抽样项目名称!');
            }
            if (!projectOverallProps.curSampleTable?.sampleTextFieldsArray.length) {
                return msgError('项目字段不能为空,请选择项目字段!');
            }


            const sampleTotalCount = samplingProjectOverallRef.current?.getSampleTotalCount();
            if (sampleTotalCount) {
                sampleStepInfo.step1CanRender = true;//第2步可以渲染
                //用当前函数值赋给sampleStepInfo.projectOverallProps

                await updateProjectOverallPropsByRef();

                await changeCurrentNum(true)
            } else {
                return msgError('样本总体为0,请先在第1步中,查询数据确定样本总体!');
            }

        } else if (stepCurrent == 1) {
            sampleStepInfo.sampleParameterValues = sampleParmeterRef.current?.getSampleParameterValues();
            const sampleParameterValues: SampleParameterValues = sampleStepInfo.sampleParameterValues as any;
            if (sampleParameterValues) {
                if (!sampleParameterValues.sampledResult?.sampledSize) {
                    return msgError('抽样数据为0,还没有进行抽样!');
                }
                // const typedSampleList = await getTypedSampleList(sampleStepInfo, sampleParameterValues, false);

                sampleStepInfo.step2CanRender = true;

                await changeCurrentNum(true)
            } else {
                return msgError('抽样参数不能为空,请输入抽样参数!');
            }
        }

    }
    //完成点击 保存数据
    const finishStepClick = async () => {
        //编辑和增加时,要保存

        if (diaParamsRef.current?.sampleRecordEditType &&
            [SampleRecordEditType.add, SampleRecordEditType.edit].includes(diaParamsRef.current?.sampleRecordEditType)) {
            //如果保存时,sampleStepInfo.sampleParameterValues没有值,使用sampleStepInfoOfParams的
            const sampleStepInfoOfParams: SampleStepInfo | undefined = diaParamsRef.current?.sampleStepInfo;
            if (!sampleStepInfo.sampleParameterValues && sampleStepInfoOfParams?.sampleParameterValues) {
                sampleStepInfo.sampleParameterValues = sampleStepInfoOfParams?.sampleParameterValues;
            }
            sampleStepInfo.sampleMethodActiveKey = sampleParmeterRef.current?.sampleMethodActiveKey;

            setLoading(true)
            //编辑状态时,要先删除原来的checked的,否则会导致,新的数量小于老的,样本源表中还会保留上次抽样记录
            if (SampleRecordEditType.edit == diaParamsRef.current?.sampleRecordEditType) {

                //重新查询数据库保存的信息,当期的sampleStepInfo可能别改变了
                const sampleRecordList: SampleReord[] = await getSampleRecordList(dbname, '', '', 0, 1, `'${sampleStepInfo.guid}'`)
                if (sampleRecordList.length) {
                    const sampleRecord = sampleRecordList[0];
                    const oldSampleStepInfo = sampleRecord.sampleStepInfo as SampleStepInfo;
                    if (! await updateTableIsChecked(oldSampleStepInfo, oldSampleStepInfo?.sampleParameterValues as any, false, dbname)) {
                        setLoading(false)
                        return;
                    }
                }
            }
            const typedSampleInfo = await getTypedSampleList(sampleStepInfo, sampleStepInfo.sampleParameterValues as any, false);


            //更新凭证表
            const createTableResult = await createAllSampleListTable(sampleStepInfo, dbname);

            if (!createTableResult) {
                setLoading(false)
                return;
            }
            let allSampleDataList: any[] = getAllSampleDataList(sampleStepInfo, typedSampleInfo);

            //插入样本分类表
            const insertResult = await insertAllSampleListTable(sampleStepInfo, dbname, allSampleDataList, sampleStepInfo.guid || '');

            if (!insertResult) {
                setLoading(false)
                return;
            }

            const updateResult = await updateTableIsChecked(sampleStepInfo, sampleStepInfo.sampleParameterValues as any, true, dbname)
            if (updateResult) {
                await diaParamsRef.current?.saveSampleRecordAndRefresh(sampleStepInfo);//保存抽样记录并刷新  
                setLoading(false)
            } else {
                setLoading(false)
                return;
            }
        }
        setVisible(false);
        diaParamsRef.current?.closeSamplingRecordPopup(true);//关闭弹窗;
    }

    function rightContainer() {

        if (!sampleStepInfo.projectOverallProps?.curSampleTable) return null;

        //  console.log('sampleStepInfo.projectOverallProps,', sampleStepInfo.projectOverallProps)
        //const projectOverallProps: ProjectOverallProps = getProjectOverallProps();

        //  const projectOverallProps: ProjectOverallProps = sampleStepInfo.projectOverallProps || getIniProjectOverallProps();

        const sampleStep: SampleStep = {}
        sampleStep.step0CanRender = sampleStepInfo.step0CanRender;
        sampleStep.step1CanRender = sampleStepInfo.step1CanRender;//(sampleProjectOverallProps.curSampleTableTotalCount || 0) > 0 ? true : false;
        sampleStep.step2CanRender = sampleStepInfo.step2CanRender;

        //抽样总体
        sampleStep.step0Content = <SamplingProjectOverall
            ref={samplingProjectOverallRef}
            propsOfParams={sampleStepInfo.projectOverallProps}
            sampleStepInfo={sampleStepInfo}
            setSampleStepInfo={setSampleStepInfo}

        //  {...sampleStepInfo.projectOverallProps}
        />
        // sampleStepInfo.projectOverallProps = projectOverallProps;
        sampleStepInfo.stepCurrent = stepCurrent;

        //上一个界面传的参数(编辑或查看)
        const sampleStepInfoOfParams: SampleStepInfo | undefined = sampleStepInfo;// 20241114改 diaParamsRef.current?.sampleStepInfo;

        //抽样参数
        sampleStep.step1Content = !sampleStep.step1CanRender ?
            <div style={{ fontSize: '20px', color: 'red' }}>请先确定抽样总体</div> :
            (
                <SampleStepInfoContext.Provider
                    value={sampleStepInfo}>
                    <SampleParmeter
                        ref={sampleParmeterRef}
                        sampleStepInfoOfParams={sampleStepInfoOfParams}
                    />
                </SampleStepInfoContext.Provider>
            )

        sampleStep.step2Content = !sampleStep.step2CanRender ?
            <div style={{ fontSize: '20px', color: 'red' }}>请先确定抽样参数</div> :
            (
                <SampleStepInfoContext.Provider
                    value={sampleStepInfo}>
                    <SamplingSampleList
                        ref={samplingSampleListRef}
                        sampleStepInfo={sampleStepInfo}
                    // typedSampleInfo={typedSampleInfo}
                    // setTypedSampleInfo={setTypedSampleInfo}
                    />
                </SampleStepInfoContext.Provider>
            )

        updateSampleStepDisplay(sampleStep, stepCurrent);

        return (<div style={{ marginLeft: "15px", height: "100%", overflow: 'hidden', position: 'relative' }}>

            <div style={{ height: '83vh' /* ,border: '1px solid blue' */ }}>
                <div style={{ display: sampleStep.step0Display }} >{sampleStep.step0Content}</div>
                <div style={{ display: sampleStep.step1Display }}>{sampleStep.step1Content}</div>
                <div style={{ display: sampleStep.step2Display }}>{sampleStep.step2Content}</div>
            </div>
            <Space style={{ position: 'absolute', bottom: '0px', right: '15px' }}>
                {stepCurrent > 0 && (
                    <Button style={{ margin: '0 8px', zIndex: 2000 }} size='small' disabled={loading} onClick={previousStepClick}>
                        上一步
                    </Button>
                )}
                {stepCurrent < steps.length - 1 && (
                    <Button type="primary" style={{ zIndex: 2000 }} size='small' disabled={loading} onClick={nextStepClick}>
                        下一步
                    </Button>
                )}
                {stepCurrent === steps.length - 1 && (
                    <Button type="primary" style={{ zIndex: 2000 }} size='small' disabled={loading} onClick={finishStepClick}>
                        完成
                    </Button>
                )}
            </Space>
        </div >);
    }


    return (
        <>
            <Popup
                ref={popupRef}
                visible={visible}
                title={'审计抽样 ' + (sampleStepInfo.projectOverallProps?.curSampleItem?.itemName || '')}
                width={'98vw'}
                height={'98vh'}
                onTitleRendered={(e) => { devPopupTitleRendered(e) }} //解决 dx-popup 标题有....的问题

                // dragOutsideBoundary={true}
                // resizeEnabled={true}
                onHiding={() => { onCancel() }}
            >
                <div style={{ height: '100%', width: '100%', overflow: 'hidden' }} >
                    <LayoutB
                        rowSize={["180px", "180px"]}
                        leftSlot={leftContainer()}
                        rightSlot={rightContainer()}
                    />
                    {/*   <LoadPanel visible={loading} /> */}
                </div>

            </Popup>
        </>
    );
});

export default SamplingRecordPopup;
export { SampleStepInfoContext }; // 必须这样写 重要！